<?php session_start();
/**
* @package		Parents@School.
* @copyright	Copyright (C) 2008 Kristof Beckers. All rights reserved.
* @Version		1.0
* @license		GNU/GPL, see LICENSE.php
**/

include ("../../include/config.php");
require_once ("../../include/db.php");
include ("../../include/header.php");

if(isset($_SESSION['myusername'])){
	if ($_SESSION['admin'] == "$adminid") {
	
$idreset = $_GET['id'];
$username = $_GET['username'];
$passwd1 = $_POST['passwd1'];
$passwd2 = $_POST['passwd2'];
$id = $_POST['id'];



?><head>
<link rel="stylesheet" href="../../css/template_css.css" type="text/css"/> 
</head>
<body>
<div align="center"><img src="<?php echo "../$logo" ; ?>" />
</div> <div align="center">    <p>&nbsp;</p>
    <p><a href="users.php"><img src="../../images/users.png" width="128" height="128" border="0"></a></p><?php 
if	($passwd1 == ''){
?>
<form name="form1" method="post" action="users_password_reset.php">
 

    <p>Verander het wachtwooord van &quot;<?php echo " $username " ; ?> &quot; </p>
    <p>&nbsp;</p>
    <p>Geef het wachtwoord 2x in en klik op verstuur. </p>
    <p>
      <input name="passwd1" type="password" id="passwd1">
      <input name="id" type="hidden" value="<?php echo $idreset ; ?>">
    </p>
    <p>
      <input name="passwd2" type="password" id="passwd2">
    </p>
    <p>
      <input name="Verstuur" type="submit" id="Verstuur" value="Verstuur">
    </p>
 
</form>

<?php
}
else{
	if ($passwd1 !== $passwd2){
	echo "De wachtwoorden komen niet overeen, Probeer opnieuw";
	}
	else 
	{
	$passwordmd5 = md5($passwd1) ; 
	$sqlupdate = "UPDATE $tbusers SET password = '$passwordmd5' WHERE ID='$id'";
mysql_query($sqlupdate) or die(mysql_error());
echo 	"Het wachtwoord is aangepast<br />
Ga verder";
}}

}}
?> </div>
</body>